Spyder - Introduction

Spyder is a scientific Python Development environment.

Spyder is an interactive development environment for the Python language with editing, interactive testing, debugging and introspection features.

Spyder may also be used as a library providing console-related widgets for PyQt-based applications. For example, Spyder may be used to integrate a debugging console directly in the layout of graphical user interface.

Spyder websites:

Contents:

Indices and tables:

Editor

Spyder’s text editor is a multi-language editor with features such as syntax coloring, code analysis (real-time code analysis using pyflakes and advanced code analysis using pylint), introspection capabilities such as code completion, call tips and go-to-definition features (using rope), function/class browser, horizontal/vertical splitting features, etc.

Function/class/method browser:

Fig.1 Function/class browser in Spyder

Fig.1 shows the function/class browser in Spyder with Python code.

Code analysis with pyflakes:

Fig.2 Code analysis with pyflakes.

Fig.2 shows code analysis with pyflakes in Spyder browser. The browser displays messages (the red triangle on the left side) means something wrong in the code.

Horizontal/vertical splitting feature:

Fig.3 Horizontal/vertical splitting window.

Fig.3 shows the window in Spyder can be splitted horizontally or vertically.

How to define a code cell

A “code cell” is a block of lines to be executed at once in the current interpreter (Python or IPython). A script can be divided in many cells if needed.

Cells are separated by lines starting with:

  • #%% (standard cell separator)
  • # %% (standard cell separator, when file has been edited with Eclipse)
  • # <codecell> (IPython notebook cell separator)

Related plugins:

Projects

Spyder allows users to associate a given directory with a project. This has two advantages:

  1. Projects remember the list of open files in Spyder. This permits to work on several coding efforts at the same time.
  2. The project’s path is added to the list of paths which Python looks modules for, so that modules developed as part of a project can be imported in any console.

To create a project, Select the "New Project" entry from the "Projects" menu:

Fig.4 Create a project from "Projects" => "New Project" menu.

When a project is activated, the project explorer pane is shown on the left, which presents a tree file structure of the current project.

Fig.5 The project explorer with tree file structure.

Files belong to the project can be operated through the pane by right click.

Fig.6 Make operations on files by right click.

Note

Creating a project is not necessary. Code can work without any project.

Version Control Integration

Spyder has limited integration with Git and Mercurial. Commit and browse commands are available by right-clicking on relevant files that reside in an already initialized repository. This menu assume that certain commands are available on the system path.

  • For Mercurial repositories, TortoiseHG must be installed, and either thg or hgtk must be on the system path.
  • For Git repositories, the commands git and gitk must be on the system path. For Windows systems, the Git for Windows package provides a installer and the option to place common git commands on the system path, and avoid creating conflicts with Windows system tools. The second option in the dialog below is generally a safe approach.

Fig.7 Set the PATH of Git in dialog.

results matching ""

    No results matching ""